# Contributor: Andy Postnikov <apostnikov@gmail.com>
# Contributor: Sandro Jäckel <sandro.jaeckel@posteo.de>
# Contributor: Sergei Lukin <sergej.lukin@gmail.com>
# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=wget2
pkgver=2.1.0
pkgrel=0
pkgdesc="Network utility to retrieve files from the Web"
url="https://www.gnu.org/software/wget/wget.html"
arch="all"
license="GPL-3.0-or-later WITH OpenSSL-Exception"
makedepends="
	brotli-dev
	bzip2-dev
	doxygen
	graphviz
	libidn2-dev
	lzlib-dev
	texinfo
	nghttp2-dev
	openssl-dev
	pcre2-dev
	zlib-dev
	zstd-dev
	xz-dev
	"
checkdepends="libmicrohttpd-dev"
subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-libs"
source="https://ftp.gnu.org/gnu/wget/wget2-$pkgver.tar.gz"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-libidn \
		--with-ssl=openssl \
		--without-libpsl \
		--without-libhsts \
		--without-gpgme \
		--enable-fuzzing \
		--disable-manylibs \
		--disable-nls \
		--disable-rpath
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	rm -f "$pkgdir/usr/bin/wget2_noinstall"
	install -Dm644 docs/man/man1/wget2.1 -t "$pkgdir"/usr/share/man/man1/
}

sha512sums="
ae1fc267b1c2ee182ee59f0fc34fef238326a20f1ea1c15be6db2c16b70d49e89f61ca937d3e64d214f73ef9646ba4318782ac4210db51bd3d89c55ce4406872  wget2-2.1.0.tar.gz
"
